<?php

class TrackController extends Controller{
    public function listar(){
        $vars = array();
        $vars['page'] = 1;
        if(!empty($_GET['page'])){$vars['page'] = intval($_GET['page']); }
        $vars['title'] = "Lista de Tracks";
        try{
            $objTrack = new Track;
            $objChair = new Chair;
            if(!empty($_SESSION['usuario_autenticado'])){
                $vars['data'] = $objTrack->listar('TRUE', $vars['page'], 10, 'id_track', 'DESC');
                $vars['data_chair'] = $objChair->listar('TRUE', $vars['page'], 10, 'nombre', 'DESC');
                $this->view->show('adm_track_comite' , 'intranet', $vars);
            }else{
                $vars['flag'] = "Debe ingresar al sistema";
                $this->view->show('login' , 'default', $vars);
            }

        }
        catch(Exception $e){
            $vars['flag'] = $e->getMessage();
            $this->view->show('home' , 'intranet', $vars);
        }
	}
}
?>
